package com.yc.springmvc.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
public class IndexContrller {
    @RequestMapping("hello")
    String hello(String name){return "hello"+name;}


    @RequestMapping("toPage")
    ModelAndView toPage(String page){
        page = page == null ? "A" :page;
        ModelAndView mav =new ModelAndView();
        mav.setViewName("redirect:" +page + ".html");
        return mav;
    }
}
